package  
{
	import flash.utils.getTimer;
	import org.flixel.FlxG;
	import org.flixel.FlxPoint;
	import org.flixel.FlxRect;
	import org.flixel.FlxU;
	import org.flixel.plugin.photonstorm.FlxWeapon;

	public class Knight extends AlienBasic
	{
		
		private var lastFired:uint = 0;
		private var nextFire:uint = 0;
		private var fireRate:uint = 1300;
		public function Knight() 
		{
			super();
			makeGraphic(20, 20, 0xFF00FF00);
			
		}
		
		override public function fire():Boolean {
			if (fireRate > 0 && getTimer() < nextFire) {
				return false;
			}
			
			if (this.x > 300) {
				
				lastFired = getTimer();
				nextFire = getTimer() +fireRate;
				
				Registry.knightWep.setFiringPosition(this.x, this.y, 0, -10);
				Registry.knightWep.fireAtTarget(Registry.player);
			}
			return true;
		}
		
		/*override public function update():void {
			velocity.y = Math.cos(x / 50) * 50;
            super.update();

			if (x < -50)
			{
				exists = false;
			}
			if(onScreen()){
				fire();
				trace("fired");
			}
		}*/
		
	}

}